<input type="number" min="0" step="1" />
<form method="post">
<label for="myNumber">My Number:</label>
<input type="number" maxlength="9" required
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" >
<br><br>
<input type="submit" value="Submit">
</form>
<input maxlength="10" />
<input name="somename"
oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
type = "number"
maxlength = "6"
/>
<input type="text" pattern="\d*" maxlength="4">